#pragma once
#include <juce_gui_extra/juce_gui_extra.h>
#include <juce_audio_processors/juce_audio_processors.h>

// 基础节点类
class UI_Reverb : public juce::Component
{
public:
    UI_Reverb(const juce::String& title,juce::AudioProcessorValueTreeState& parameters);
    ~UI_Reverb() ;//override = default;

    void paint(juce::Graphics& g) override;
    void resized() override;
    void mouseDown(const juce::MouseEvent& e) override;
    void mouseDrag(const juce::MouseEvent& e) override;
    void mouseMove(const juce::MouseEvent& e) override;
    void mouseUp(const juce::MouseEvent& e) override;
    void mouseExit(const juce::MouseEvent& e) override;

protected:


private:
    enum ParamId
    {
        param_mix = 0,
        param_tone,
        param_feedback,
        param_damp
    };

    juce::Slider sli_param_mix      { juce::Slider::Rotary, juce::Slider::TextBoxBelow};
    juce::Slider sli_param_tone     { juce::Slider::Rotary, juce::Slider::TextBoxBelow};
    juce::Slider sli_param_feedback { juce::Slider::Rotary, juce::Slider::TextBoxBelow};
    juce::Slider sli_param_damp     { juce::Slider::Rotary, juce::Slider::TextBoxBelow};
    juce::Label  lbl_param_mix      { {}, "Mix" };
    juce::Label  lbl_param_tone     { {}, "Tone" };
    juce::Label  lbl_param_feedback { {}, "Feedback" };
    juce::Label  lbl_param_damp     { {}, "Damp" };

    int param_value_mix      = 0;
    int param_value_tone     = 0;
    int param_value_feedback = 0;
    int param_value_damp     = 0;

    juce::LookAndFeel *lookAndFeel;
    juce::Point<float> dragOffset;
    bool isDragging = false;

    std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment> mixAttachment;
    std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment> toneAttachment;
    std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment> feedbackAttachment;
    std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment> dampAttachment;

    void paramChanged(ParamId id, float newValue);



};